<?php 
class Utils {
	protected $db;
	
	function __construct($db) {
		$this->db = $db;	
	}
	
	function getSubCategory($cat) {
		$sql = "Select * from categories where parent_id = {$cat}";
		$this->db->query($sql);
		// get rows
		$rows = $this->db->getRowList();
		
		return $rows;
	}
	
	function getProduct($pId) {
		$sql = "SELECT * FROM products WHERE id = {$pId}";
		$this->db->query($sql);
		$row = $this->db->getRow();
		return $row;
	}
}
?>